<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const num = +prompt("number?");

      // 根据条件动态创建函数
      let f1 =
        num > 18
          ? function () {
              console.log("hello f1");
            }
          : function () {
              console.log("hi f1");
            };
      f1();
    </script>
  </body>
</html>
